/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb.archive;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author ciummo
 */
@Stateless
public class ReportFacade extends AbstractFacade<Report> implements ReportFacadeRemote {
    @PersistenceContext(unitName = "DGestEJBSeverPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ReportFacade() {
        super(Report.class);
    }
    
    public List<Report> findReportByCode (String code){

        String sql = "SELECT r FROM Report r WHERE r.codRiferimento = :codRiferimento";
        Query query = em.createQuery(sql);
        query.setParameter("codRiferimento", code);
        return query.getResultList();
    } 
    
    
    
}
